﻿#region Copyright and Licensing Notice
// Copyright (C) 2011 Steven Bosnick
// 
// This program is open source software; you can redistribute it 
// and/or modifiy it under the terms of the Eclipse Public License,
// version 1.0.
// 
// This program is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A 
// PARTICULAR PURPOSE. See the Eclipse Public License for more
// details.
// 
// You should have received a copy of the Eclipse Public License 
// along with this program; if not, you can find a copy at
// "http://www.opensource.org/licenses/eclipse-1.0.php".
#endregion
using System;
using BitwiseOre.SharedMemory.JetBrains;

namespace BitwiseOre.SharedMemory.Context
{
    /// <summary>
    /// Describes the context within which a new <see cref="SharedMemoryStream"/>
    /// is created.
    /// </summary>
    [UsedImplicitly(ImplicitUseTargetFlags.Members)]
    public interface IStreamContext
    {
        /// <summary>
        /// The total amount of shared memeory used to buffer the data being transfered in each direction.
        /// </summary>
        /// <remarks>
        ///     If <see cref="BufferSize"/> is not a multiple of <see cref="ChunckingFactor"/> then
        ///     there will be some unused space at the end of the buffer.
        /// </remarks>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     The value being set was less than 1.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     The value being set was less then the <see cref="ChunckingFactor"/>
        /// </exception>
        int BufferSize { get; set; }

        /// <summary>
        /// The number of chunks into which the buffer is divided.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     The value being set was less than 1.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     The value being set was greater than the <see cref="BufferSize"/>
        /// </exception>
        int ChunckingFactor { get; set; }
    }
}